package com.ms.teapuesto.jsf.admin;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.AnnotationBeanNameGenerator;
import org.springframework.util.ClassUtils;

/**
 * User: gmc
 * Date: 13/03/13
 */
public class JsfBeanNameGenerator extends AnnotationBeanNameGenerator {

    protected String buildDefaultBeanName(BeanDefinition definition) {
        String shortClassName = ClassUtils.getShortName(definition.getBeanClassName());
        if (!shortClassName.startsWith("FN")) {
            return super.buildDefaultBeanName(definition);
        }
        return "fn" + shortClassName.substring(2);
    }

}

